package com.jt.msg.req;

import com.jt.msg.DataPacket;
import io.netty.buffer.ByteBuf;

/**
 * 注册包
 *
 * @author wang xiao
 * date 2023/8/9
 */

public class RegisterMsg extends DataPacket {

    /**
     * 省域ID 2字节
     */
    private short provinceId;

    /**
     * 市县ID 2字节
     */
    private short cityId;

    /**
     * 市县ID 2字节
     */
    private String manufacturerId;

    /**
     * 终端型号 8字节
     */
    private String terminalType;

    /**
     * 终端ID 7字节
     */
    private String terminalId;

    /**
     * 车牌颜色 1字节
     */
    private byte licensePlateColor;

    /**
     * 车牌号 剩余字节
     */
    private String licensePlate;

    public RegisterMsg(ByteBuf byteBuf) {
        super(byteBuf);
    }

    @Override
    public void parseBody() {
        ByteBuf bb = this.payload;
        this.setProvinceId(bb.readShort());
        this.setCityId(bb.readShort());
        this.setManufacturerId(readString(5));
        this.setTerminalType(readString(8));
        this.setTerminalId(readString(7));
        this.setLicensePlateColor(bb.readByte());
        this.setLicensePlate(readString(bb.readableBytes()));
    }


    public short getProvinceId() {
        return provinceId;
    }

    public void setProvinceId(short provinceId) {
        this.provinceId = provinceId;
    }

    public short getCityId() {
        return cityId;
    }

    public void setCityId(short cityId) {
        this.cityId = cityId;
    }

    public String getManufacturerId() {
        return manufacturerId;
    }

    public void setManufacturerId(String manufacturerId) {
        this.manufacturerId = manufacturerId;
    }

    public String getTerminalType() {
        return terminalType;
    }

    public void setTerminalType(String terminalType) {
        this.terminalType = terminalType;
    }

    public String getTerminalId() {
        return terminalId;
    }

    public void setTerminalId(String terminalId) {
        this.terminalId = terminalId;
    }

    public byte getLicensePlateColor() {
        return licensePlateColor;
    }

    public void setLicensePlateColor(byte licensePlateColor) {
        this.licensePlateColor = licensePlateColor;
    }

    public String getLicensePlate() {
        return licensePlate;
    }

    public void setLicensePlate(String licensePlate) {
        this.licensePlate = licensePlate;
    }
}
